package com.io.file;

import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author xin.ding
 * @date 2021/5/19 14:14
 */
public class BigFileReaderTest {
    public static void main(String[] args) {
        AtomicLong counter = new AtomicLong(0);
        String bigFilePath = "C:\\tmp\\test.txt";
        BigFileReader.Builder builder = new BigFileReader.Builder(bigFilePath, line -> System.out.println(String.format("total record: %s,line is: %s", counter.incrementAndGet(), line)));
        BigFileReader bigFileReader = builder
                .threadPoolSize(2)
                .charset(StandardCharsets.UTF_8)
                .bufferSize(1024 * 1024).build();
        bigFileReader.start();

    }
}
